Skip to content

Feat/verification json output#196

Open
shrutu0929 wants to merge 4 commits into
Refactron-ai:mainfrom
shrutu0929:feat/verification-json-output
Open

Feat/verification json output#196
shrutu0929 wants to merge 4 commits into
Refactron-ai:mainfrom
shrutu0929:feat/verification-json-output

Conversation

@shrutu0929
Copy link
Copy Markdown

solve #189
This change adds machine-readable JSON output to Refactron's verification pipeline so that CI gates, bots, and parent tooling can consume structured results instead of scraping
Rich-formatted terminal text. It introduces to_json_dict() helpers on the VerificationResult and CheckResult data contracts, backed by a JSON_SCHEMA_VERSION constant so the schema can evolve safely for downstream consumers, along with a format_verification_result_json() formatter in verification/report.py. A new refactron verify CLI command is added that runs
▎ the verification engine on a code change and supports a --json flag, emitting a stable, versioned JSON object (overall status, blocking reason, confidence, timing, and per-check
▎ details) and returning exit code 0 when the change is safe to apply or 1 when it is blocked. Finally, the CLI's subcommand registration in main.py is hardened to catch any exception
▎ rather than only ImportError, so that a broken optional dependency degrades a single subcommand gracefully instead of taking down the entire CLI.

shrutu0929 and others added 3 commits April 7, 2026 18:31
TestSuiteGate.verify ran pytest via a hard-coded python3 interpreter
with cwd set to file_path.parent. For nested files this misses the
repo's pyproject.toml / pytest.ini / conftest.py and may use a
different interpreter/venv than the host process, causing false
positives or undiscovered tests and CI-vs-local mismatch.

- Run pytest via sys.executable instead of python3.
- Set cwd to the resolved project root (project_root or file dir).
- Prepend the project root to PYTHONPATH for layouts that rely on it.
- Add tests asserting the interpreter, cwd, and PYTHONPATH.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a stable, versioned JSON report for verification results so CI
gates, bots, and parent tools can consume structured data instead of
scraping Rich terminal output.

- VerificationResult.to_json_dict() / CheckResult.to_json_dict() and a
  JSON_SCHEMA_VERSION constant in verification/result.py
- format_verification_result_json() in verification/report.py
- new `refactron verify` command with --json (verify.py); exit code 0
  when safe to apply, 1 when blocked
- main.py: widen subcommand import guards to except Exception so a
  broken optional dependency degrades gracefully instead of taking
  down the whole CLI

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@shrutu0929 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 58 minutes and 56 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5a96a87d-42a4-40ea-b1b4-6ff9d072a4d8

📥 Commits

Reviewing files that changed from the base of the PR and between 2f04295 and a3f0ba5.

📒 Files selected for processing (7)
  • refactron/cli/main.py
  • refactron/cli/verify.py
  • refactron/verification/checks/test_gate.py
  • refactron/verification/report.py
  • refactron/verification/result.py
  • tests/test_test_gate.py
  • tests/test_verification_result.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant